<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('催款申请列表')" />
</head>
<body class="gray-bg">
<div style="background-color: white">
    <a class="btn btn-info btn-outline visible-xs-block" href="#" onclick="$.modal.closeTab()">返回</a>
</div>
     <div class="container-div">
        <div class="row">
            <form id="formId" th:object="${pId}">
                <!-- <input name="bId" th:field="*{bId}" type="hidden">-->
            </form>
<!--            <div class="col-sm-12 search-collapse">-->
<!--                <form id="formId">-->
<!--                    <div class="select-list">-->
<!--                        <ul>-->
<!--                            <li>-->
<!--                                <label>催款金额：</label>-->
<!--                                <input type="text" name="pfmPrice"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>已付金额：</label>-->
<!--                                <input type="text" name="paidPrice"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>未付金额：</label>-->
<!--                                <input type="text" name="unpaidPrice"/>-->
<!--                            </li>-->
<!--                            <li class="select-time">-->
<!--                                <label>申请时间：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginApplyTime]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endApplyTime]"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>关联项目id：</label>-->
<!--                                <input type="text" name="pId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
<!--                            </li>-->
<!--                        </ul>-->
<!--                    </div>-->
<!--                </form>-->
<!--            </div>-->

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ruoyi:application:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ruoyi:application:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ruoyi:application:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:applications:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->

            </div>
            <div class="col-sm-12 select-table table-striped" style="font-size: 15px; ">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var pId=[[*{pId}]];
        var editFlag = [[${@permission.hasPermi('ruoyi:applications:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:application:remove')}]];
        var aPaymentStatus =  [[${@dict.getType('dunningfrom_price_status')}]];
        var prefix = ctx + "ruoyi/applications"
        $(function() {
            var options = {
                url: prefix + "/lists/"+pId,
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "已付金额",
                rowStyle:{
                    css:{"color":"black"}
                },
                columns: [
                {
                    field: 'dId', 
                    title: '主键id',
                    visible: false
                },
                {
                    //field: 'dCost',
                    title: '催款金额',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('￥'+row.dCost);
                        return actions.join('');
                    },
                },
                {
                   // field: 'aAmountPaid',
                    title: '已付金额',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.aAmountPaid==null){
                            actions.push('￥'+0.00);
                            return actions.join('');
                        }else{
                            actions.push('￥'+row.aAmountPaid);
                            return actions.join('');
                        }
                    }
                },
                {
                    field: 'aUnpaidAmount',
                    title: '未付金额',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.aUnpaidAmount==null){
                            actions.push('￥'+row.aUnpaidAmount)
                            return actions.join('');
                        }
                        actions.push('￥'+row.aUnpaidAmount);
                        return actions.join('');
                    },
                },
                {
                    field: 'dCreateTime',
                    title: '申请时间',
                },
                    {
                        field: 'aPaymentStatus',
                        title: '支付状态',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(aPaymentStatus, value);
                        }
                    },
                {
                    field: 'pId',
                    title: '关联项目id',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.dId + '\')"><i class="fa fa-edit"></i>添加已付金额</a> ');
                        //actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.dId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>